public class TreeHigh {

    static class BinaryTree {
        public BinaryTree left;
        public BinaryTree right;
        public int val;

        public BinaryTree(int val) {
            this.val = val;
        }
    }

    public BinaryTree root;

    public void initBinaryTree() {
        BinaryTree A = new BinaryTree('1');
        BinaryTree B = new BinaryTree('2');
        BinaryTree C = new BinaryTree('3');
        BinaryTree D = new BinaryTree('4');
        A.left = B;
        A.right = C;
        B.left = D;
        root = A;
    }

    public int myTreeHigh(BinaryTree root) {
        if (root == null){
            return 0;
        }
        int leftHigh = myTreeHigh(root.left);
        int rightHigh = myTreeHigh(root.right);
        return (leftHigh > rightHigh) ? (leftHigh + 1) : (rightHigh +1);
    }
}
